// main.go
package main

/*
#include <stdio.h>
#include <stdlib.h>

void printMessage(char* message) {
    printf("C function says: %s\n", message);
}
*/
import "C"
import (
	"fmt"
	"unsafe"
)

func main() {
	message := C.CString("Hello from Go!")
	defer C.free(unsafe.Pointer(message))

	C.printMessage(message)
	fmt.Println("Go function says: Hello from Go!")
}

// 编译命令 (在Windows命令提示符中运行):
// set CGO_ENABLED=1
// set GOOS=linux
// set GOARCH=amd64
// set CC=x86_64-w64-mingw32-gcc
// go build -o myapp
